import { request } from "@utils/http/index"



import {
    getHosListSearchParamsType,    //请求医院列表参数中searchParams的类型
    getHosListReqReturnType,       //获取医院列表请求的返回值的完整类型
    getThreeReturnType,            //三级联动的返回值类型
    getHosListDetialReqType,       //医院详情请求返回值类型
    getHosDepartmentReqType,       //获取科室数据请求返回值的类型
    scheduleRuleParamsType,        //某个科室的排班规则参数类型
    scheduleRuleReturnType,        //某个科室的排班规则返回值类型
    findScheduleListParams,        //获取科室日期信息信息参数类型
    findScheduleListReturn,        //获取科室日期信息信息返回值类型
} from "./model/hospitalListTypes"

//1.医院列表中 获取医院列表的请求
export const getHospitalListRequest = (page: number, limit: number, searchParams: getHosListSearchParamsType) => {
    return request.get<any, getHosListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`, {
        params: searchParams
    })
}

//2.医院列表中 请求省份
export const getProvinceRequest = () => {
    return request.get<any, getThreeReturnType>("/admin/cmn/dict/findByDictCode/province")
}

//3.医院列表中 请求市或区
export const getCityOrblockRequest = (value: string) => {
    return request.get<any, getThreeReturnType>(`/admin/cmn/dict/findByParentId/${value}`)
}

//4.医院列表中 医院详情请求
export const getHosListDetialRequest = (id: string) => {
    return request.get<any, getHosListDetialReqType>(`/admin/hosp/hospital/show/${id}`)
}

//5.医院列表中 上下线状态请求
export const hospitalCheckedStatusRequest = (id: string, status: 0 | 1) => {
    return request.get<any, null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}


//6.获取科室数据
export const getHospitalDepartmentRequest = (hoscode: string) => {
    return request.get<any, getHosDepartmentReqType>(`/admin/hosp/department/${hoscode}`)
}

//7.获取某个科室的排班规则请求
export const getScheduleRuleRequest = ({ page, limit, hoscode, depcode }: scheduleRuleParamsType) => {
    return request.get<any, scheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

//8.获取科室排班日期详细规则
export const findScheduleListRequest = ({ hoscode, depcode, workDate }: findScheduleListParams) => {
    return request.get<any, findScheduleListReturn>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}

